package com.alibaba.dubbo.container.spring;

import org.springframework.beans.BeansException;
import org.springframework.context.ApplicationContext;

import com.alibaba.dubbo.common.inet.InetAddressMatcher;
import com.alibaba.dubbo.common.utils.NetUtils;

public class InetAddressMatcherSetter implements org.springframework.context.ApplicationContextAware
	/*, BeanPostProcessor */{
	String matcher;

	public void setMatcher(String matcher) {
		this.matcher = matcher;
	}

	ApplicationContext context;
	@Override
	public void setApplicationContext(ApplicationContext applicationContext)
			throws BeansException {
		this.context = applicationContext;
		InetAddressMatcher result = (InetAddressMatcher)this.context.getBean(matcher);
		NetUtils.setInetAddressMatcher(result); 
	}

	/*
	@Override
	public Object postProcessBeforeInitialization(Object bean, String beanName)
			throws BeansException {
		return bean;
	}

	@Override
	public Object postProcessAfterInitialization(Object bean, String beanName)
			throws BeansException {
		
		return bean;
	}
	*/
}
